<!DOCTYPE html>
<html lang="zh-CN" xmlns:th="http://www.thymeleaf.org">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>发布公告</title>
    <link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.0/dist/css/bootstrap.min.css" rel="stylesheet">
    <style>
        body {
            background: linear-gradient(-45deg, #e9e2f3, #d4c9e8, #d1c9ec);
            background-size: 400% 400%;
            animation: gradient 8s ease infinite;
            min-height: 100vh;
            padding: 2rem 0;
            margin: 0;
        }
        @keyframes gradient {
            0% { background-position: 0% 50%; }
            50% { background-position: 100% 50%; }
            100% { background-position: 0% 50%; }
        }
        .card {
            background-color: rgba(255, 255, 255, 0.9);
            border-radius: 12px;
            box-shadow: 0 10px 30px rgba(0, 0, 0, 0.08);
            backdrop-filter: blur(5px);
            padding: 2rem;
            max-width: 800px;
            margin: 0 auto;
        }
        .card-title {
            color: #333;
            font-weight: 700;
            margin-bottom: 1.5rem;
            position: relative;
            padding-bottom: 0.5rem;
            text-align: center;
        }
        .card-title::after {
            content: '';
            width: 50px;
            height: 3px;
            background-color: #8ab4f8;
            position: absolute;
            bottom: 0;
            left: 50%;
            transform: translateX(-50%);
        }
        .form-group {
            margin-bottom: 1.5rem;
        }
        .form-label {
            color: #666;
            font-weight: 500;
            margin-bottom: 0.5rem;
        }
        .form-control, .form-control:focus {
            border: 1px solid #eee;
            border-radius: 8px;
            box-shadow: none;
            transition: border-color 0.3s ease;
        }
        .form-control:focus {
            border-color: #8ab4f8;
        }
        .btn-group {
            display: flex;
            justify-content: center;
            gap: 1rem;
            margin-top: 2rem;
        }
        .btn {
            padding: 0.7rem 1.5rem;
            border-radius: 25px;
        }
        .error-message {
            color: #dc3545;
            text-align: center;
            margin-bottom: 1rem;
            animation: fadeIn 0.5s ease-in-out;
        }
        @keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
        textarea {
            min-height: 200px;
            resize: vertical;
        }
    </style>
</head>
<body>
<div class="card">
    <h3 class="card-title">发布新公告</h3>

    <!-- 错误提示 -->
    <div th:if="${errorMsg != null}" class="error-message" th:text="${errorMsg}"></div>

    <!-- 发布公告表单 -->
    <form th:action="@{/admin/content/announcement/publish}" method="post">
        <div class="form-group">
            <label for="title" class="form-label">公告标题 <span style="color: red;">*</span></label>
            <input type="text" class="form-control" id="title" name="title" required placeholder="请输入公告标题">
        </div>

        <div class="form-group">
            <label for="content" class="form-label">公告内容 <span style="color: red;">*</span></label>
            <textarea class="form-control" id="content" name="content" required placeholder="请输入公告详细内容"></textarea>
        </div>

        <div class="form-group form-check">
            <input type="checkbox" class="form-check-input" id="isTop" name="isTop" value="true">
            <label class="form-check-label" for="isTop">是否置顶（置顶公告将显示在最前面）</label>
        </div>

        <div class="btn-group">
            <button type="submit" class="btn btn-primary">发布公告</button>
            <a href="/admin/content/announcement/list" class="btn btn-secondary">取消返回</a>
        </div>
    </form>
</div>

<script src="https://cdn.jsdelivr.net/npm/bootstrap@5.3.0/dist/js/bootstrap.bundle.min.js"></script>
</body>
</html>